package edu.seu.mart.service.impl;

import edu.seu.mart.dao.IHistoryDao;
import edu.seu.mart.model.History;
import edu.seu.mart.service.IHistoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by samsung on 2015/4/1.
 */
@Service
public class HistoryService implements IHistoryService {

    @Resource
    private IHistoryDao historyDao;

    @Override
    public History load(int id) {
        return historyDao.load(id);
    }

    @Override
    public void add(History history) {
        if (history != null) {
            historyDao.add(history);
        }
    }

    @Override
    public void update(History history) {
        historyDao.update(history);
    }

    @Override
    public int isBrowsed(int userId, int goodsId) {
        return historyDao.isBrowsed(userId, goodsId);
    }

    @Override
    public void delete(int id) {
        historyDao.delete(id);
    }

    @Override
    public void clear() {

    }

    @Override
    public List<History> findHistoryByUserId(int userId) {
        return historyDao.findHistoryByUserId(userId);
    }
}
